home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
TEMP
/
GNU
/
bison
/
!Root
next >
Wrap
Text File
|
1995-06-28
|
8KB
|
170 lines
Top
Previous: <(dir)=>dir> * Next: <Introduction=>Introducti> * Up: <(dir)=>dir>
#Wrap on
This manual documents version 1.24 of Bison.
#Wrap off
<Introduction=>Introducti>:
<Conditions=>Conditions>:
<Copying=>Copying>: The GNU General Public License says
how you can copy and share Bison
Tutorial sections:
<Concepts=>Concepts>: Basic concepts for understanding Bison.
<Examples=>Examples>: Three simple explained examples of using Bison.
Reference sections:
<Grammar File=>GrammarFil>: Writing Bison declarations and rules.
<Interface=>Interface>: C-language interface to the parser function {fCode}yyparse{f}.
<Algorithm=>Algorithm>: How the Bison parser works at run-time.
<Error Recovery=>ErrorRecov>: Writing rules for error recovery.
<Context Dependency=>ContextDep>: What to do if your language syntax is too
messy for Bison to handle straightforwardly.
<Debugging=>Debugging>: Debugging Bison parsers that parse wrong.
<Invocation=>Invocation>: How to run Bison (to produce the parser source file).
<Table of Symbols=>TableofSym>: All the keywords of the Bison language are explained.
<Glossary=>Glossary>: Basic concepts are explained.
<Index=>Index>: Cross-references to the text.
--- The Detailed Node Listing ---
The Concepts of Bison
<Language and Grammar=>Languagean>: Languages and context-free grammars,
as mathematical ideas.
<Grammar in Bison=>GrammarinB>: How we represent grammars for Bison's sake.
<Semantic Values=>SemanticVa>: Each token or syntactic grouping can have
a semantic value (the value of an integer,
the name of an identifier, etc.).
<Semantic Actions=>SemanticAc>: Each rule can have an action containing C code.
<Bison Parser=>BisonParse>: What are Bison's input and output,
how is the output used?
<Stages=>Stages>: Stages in writing and running Bison grammars.
<Grammar Layout=>GrammarLay>: Overall structure of a Bison grammar file.
Examples
<RPN Calc=>RPNCalc>: Reverse polish notation calculator;
a first example with no operator precedence.
<Infix Calc=>InfixCalc>: Infix (algebraic) notation calculator.
Operator precedence is introduced.
<Simple Error Recovery=>SimpleErro>: Continuing after syntax errors.
<Multi-function Calc=>Multifunct>: Calculator with memory and trig functions.
It uses multiple data-types for semantic values.
<Exercises=>Exercises>: Ideas for improving the multi-function calculator.
Reverse Polish Notation Calculator
<Decls=>RpcalcDecl>: Bison and C declarations for rpcalc.
<Rules=>RpcalcRule>: Grammar Rules for rpcalc, with explanation.
<Lexer=>RpcalcLexe>: The lexical analyzer.
<Main=>RpcalcMain>: The controlling function.
<Error=>RpcalcErro>: The error reporting function.
<Gen=>RpcalcGen>: Running Bison on the grammar file.
<Comp=>RpcalcComp>: Run the C compiler on the output code.
Grammar Rules for {fCode}rpcalc{f}
<Rpcalc Input=>RpcalcInpu>:
<Rpcalc Line=>RpcalcLine>:
<Rpcalc Expr=>RpcalcExpr>:
Multi-Function Calculator: {fCode}mfcalc{f}
<Decl=>MfcalcDecl>: Bison declarations for multi-function calculator.
<Rules=>MfcalcRule>: Grammar rules for the calculator.
<Symtab=>MfcalcSymt>: Symbol table management subroutines.
Bison Grammar Files
<Grammar Outline=>GrammarOut>: Overall layout of the grammar file.
<Symbols=>Symbols>: Terminal and nonterminal symbols.
<Rules=>Rules>: How to write grammar rules.
<Recursion=>Recursion>: Writing recursive rules.
<Semantics=>Semantics>: Semantic values and actions.
<Declarations=>Declaratio>: All kinds of Bison declarations are described here.
<Multiple Parsers=>MultiplePa>: Putting more than one Bison parser in one program.
Outline of a Bison Grammar
<C Declarations=>CDeclarati>: Syntax and usage of the C declarations section.
<Bison Declarations=>BisonDecla>: Syntax and usage of the Bison declarations section.
<Grammar Rules=>GrammarRul>: Syntax and usage of the grammar rules section.
<C Code=>CCode>: Syntax and usage of the additional C code section.
Defining Language Semantics
<Value Type=>ValueType>: Specifying one data type for all semantic values.
<Multiple Types=>MultipleTy>: Specifying several alternative data types.
<Actions=>Actions>: An action is the semantic definition of a grammar rule.
<Action Types=>ActionType>: Specifying data types for actions to operate on.
<Mid-Rule Actions=>MidRuleAct>: Most actions go at the end of a rule.
This says when, why and how to use the exceptional
action in the middle of a rule.
Bison Declarations
<Token Decl=>TokenDecl>: Declaring terminal symbols.
<Precedence Decl=>Precedence>: Declaring terminals with precedence and associativity.
<Union Decl=>UnionDecl>: Declaring the set of all semantic value types.
<Type Decl=>TypeDecl>: Declaring the choice of type for a nonterminal symbol.
<Expect Decl=>ExpectDecl>: Suppressing warnings about shift\/reduce conflicts.
<Start Decl=>StartDecl>: Specifying the start symbol.
<Pure Decl=>PureDecl>: Requesting a reentrant parser.
<Decl Summary=>DeclSummar>: Table of all Bison declarations.
Parser C-Language Interface
<Parser Function=>ParserFunc>: How to call {fCode}yyparse{f} and what it returns.
<Lexical=>Lexical>: You must supply a function {fCode}yylex{f}
which reads tokens.
<Error Reporting=>ErrorRepor>: You must supply a function {fCode}yyerror{f}.
<Action Features=>ActionFeat>: Special features for use in actions.
The Lexical Analyzer Function {fCode}yylex{f}
<Calling Convention=>CallingCon>: How {fCode}yyparse{f} calls {fCode}yylex{f}.
<Token Values=>TokenValue>: How {fCode}yylex{f} must return the semantic value
of the token it has read.
<Token Positions=>TokenPosit>: How {fCode}yylex{f} must return the text position
(line number, etc.) of the token, if the
actions want that.
<Pure Calling=>PureCallin>: How the calling convention differs
in a pure parser (\*Note <Pure Decl=>PureDecl>: A Pure (Reentrant) Parser).
The Bison Parser Algorithm
<Look-Ahead=>LookAhead>: Parser looks one token ahead when deciding what to do.
<Shift/Reduce=>ShiftReduc>: Conflicts: when either shifting or reduction is valid.
<Precedence=>Precedencf>: Operator precedence works by resolving conflicts.
<Contextual Precedence=>Contextual>: When an operator's precedence depends on context.
<Parser States=>ParserStat>: The parser is a finite-state-machine with stack.
<Reduce/Reduce=>ReduceRedu>: When two rules are applicable in the same situation.
<Mystery Conflicts=>MysteryCon>: Reduce\/reduce conflicts that look unjustified.
<Stack Overflow=>StackOverf>: What happens when stack gets full. How to avoid it.
Operator Precedence
<Why Precedence=>WhyPrecede>: An example showing why precedence is needed.
<Using Precedence=>UsingPrece>: How to specify precedence in Bison grammars.
<Precedence Examples=>Precedencg>: How these features are used in the previous example.
<How Precedence=>HowPrecede>: How they work.
Handling Context Dependencies
<Semantic Tokens=>SemanticTo>: Token parsing can depend on the semantic context.
<Lexical Tie-ins=>LexicalTie>: Token parsing can depend on the syntactic context.
<Tie-in Recovery=>TieinRecov>: Lexical tie-ins have implications for how
error recovery rules must be written.
Invoking Bison
<Bison Options=>BisonOptio>: All the options described in detail,
in alphabetical order by short options.
<Option Cross Key=>OptionCros>: Alphabetical list of long options.
<VMS Invocation=>VMSInvocat>: Bison command syntax on VMS.
#Wrap on